package edu.stu.mall.fragment.hot_key

import android.app.Application
import androidx.lifecycle.viewModelScope
import edu.mall.base.BaseViewModel
import edu.mall.base.SingleLiveEvent
import edu.stu.mall.repository.Repository
import edu.stu.mall.repository.data.BannerListData
import edu.stu.mall.repository.data.ProductCategoryListData
import edu.stu.mall.repository.data.ProductCategoryListDataItem
import kotlinx.coroutines.launch

class FragHotKeyViewModel(application: Application) : BaseViewModel(application) {

    var productCategoryListData = SingleLiveEvent<ProductCategoryListData?>()

    init {
        getProductCategory()
    }

    private fun getProductCategory() {
        viewModelScope.launch {
            val data = Repository.getProductCategory()

            if (data != null) {
                productCategoryListData.postValue(data)
            }
        }
    }
}